package com.dada.mobile.shop.android;

import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.wearable.view.WatchViewStub;
import android.view.View;
import android.widget.TextView;

import java.util.Collection;

/**
 * Created by rong on 16/10/9.
 */
public class OrderInfoActivity extends Activity implements View.OnClickListener {

    private TextView addressTv;
    private TextView priceTv;
    private TextView phoneTv;
    private TextView cancelTv;
    private TextView okTv;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.order_info);
        final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);
        Bundle bundle = getIntent().getExtras();
        final Order order = (Order)bundle.getSerializable("order_info");
        stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() {
            @Override
            public void onLayoutInflated(WatchViewStub stub) {
                addressTv = (TextView) stub.findViewById(R.id.order_info);
                addressTv.setText("地址：" + order.getAddress());
                phoneTv = (TextView) stub.findViewById(R.id.order_phone);
                phoneTv.setText("电话: " + order.getPhone());
                priceTv = (TextView) stub.findViewById(R.id.order_fee);
                priceTv.setText(Float.toString(order.getPrice()));
                cancelTv = (TextView) stub.findViewById(R.id.cancel_tv);
                cancelTv.setOnClickListener(OrderInfoActivity.this);
                okTv = (TextView) stub.findViewById(R.id.ok_tv);
                okTv.setOnClickListener(OrderInfoActivity.this);
            }
        });
    }

    public void onClick(View view){
        switch (view.getId()){
            case R.id.cancel_tv:
                finish();
                break;
            case R.id.ok_tv:
                sendSureMessage();
                break;
            default:
                break;
        }
    }

    public void sendSureMessage(){

    }






}
